package com.xbongbong.saas.model.impl;

import com.xbongbong.pro.domain.dao.AiAssistantHistoryDao;
import com.xbongbong.pro.domain.entity.AiAssistantHistoryEntity;
import com.xbongbong.saas.model.AiAssistantHistoryModel;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @description: 智能助手历史记录
 * @Author: hongxiao
 * @date: 2019-05-09 21:58
 * @since v1.0
 */
@Service("ssHistoryModel")
public class AiAssistantHistoryModelImpl implements AiAssistantHistoryModel {
    @Resource
    private AiAssistantHistoryDao aiAssistantHistoryDao;

    @Override
    public Integer insert(AiAssistantHistoryEntity entity){
        return aiAssistantHistoryDao.insert(entity);
    }

    @Override
    public Integer update(AiAssistantHistoryEntity entity){
        return aiAssistantHistoryDao.update(entity);
    }

    @Override
    public List<AiAssistantHistoryEntity> findEntitys(Map<String, Object> param) {
        return aiAssistantHistoryDao.findEntitys(param);
    }

    @Override
    public Integer getEntitysCount(Map<String, Object> param) {
        return aiAssistantHistoryDao.getEntitysCount(param);
    }

    @Override
    public List findEntitysWithoutSub(Map<String, Object> param) {
        return null;
    }

    @Override
    public Integer save(AiAssistantHistoryEntity entity){

        if(entity.getId() == null || entity.getId().equals(0L)) {
            return aiAssistantHistoryDao.insert(entity);
        }
        return aiAssistantHistoryDao.update(entity);
    }

    @Override
    public void insertBatch(List<AiAssistantHistoryEntity> entityList) {
        aiAssistantHistoryDao.insertBatch(entityList);
    }

    @Override
    public AiAssistantHistoryEntity getByKey(Long key, String corpid) {
        return aiAssistantHistoryDao.getByKey(key, corpid);
    }

    @Override
    public void invalidBatch(String corpid, List<Long> idIn) {
        aiAssistantHistoryDao.invalidBatch(corpid, idIn);
    }

    @Override
    public void updateBatch(List<AiAssistantHistoryEntity> list, String corpid) {
        aiAssistantHistoryDao.updateBatch(list, corpid);
    }
}
